import Taro from "@tarojs/taro";
import { View,Text,Input,Picker,Textarea } from "@tarojs/components";
import { useState } from "react";
import './index.scss'


export default function WorkExp(props){

const {index,Info,changeExpItem}=props

const handleChange=(key,value)=>{
  changeExpItem(({//修改子类展示数据
    ...Info,
    [key]:value
    }))
}


  return(
    <View>
      <Text>工作经历{index+1}</Text>

      {/* 单位名称 */}
      <View className='at-row'>
          <View className='at-col at-col-3'>
              单位名称:
          </View>
          <Input 
            className='at-col at-col-9 contextborder' 
            name='dept'
            type='text'
            value={Info.dept}
            onBlur={(e)=>{handleChange('dept',e.detail.value)}}
          />
      </View>

      {/* 岗位名称 */}
      <View className='at-row'>
          <View className='at-col at-col-3'>
              岗位名称:
          </View>
          <Input 
            className='at-col at-col-9 contextborder' 
            name='positionName'
            type='text'
            value={Info.positionName}
            onBlur={(e)=>{handleChange('positionName',e.detail.value)}}
          />
      </View>

      <View className='at-row'>
        <View className='at-col at-col-4'>工作时间: 开始</View>

        <Picker mode='date' className='at-col at-col-6'  onChange={(e)=>{handleChange('startTime',e.detail.value)}}>
                <View className='picker'>
                  {Info.startTime}
                </View>
              </Picker>
        </View>


      <View className='at-row'>
      <View className='at-col at-col-4' style={{textIndent:'4em'}}>
        &nbsp;
      结束</View>

        <Picker mode='date' className='at-col at-col-6'  onChange={(e)=>{handleChange('endTime',e.detail.value)}}>
                <View className='picker'>
                  {Info.endTime}
                </View>
              </Picker>
        </View>

        <View>
          <View style={{marginTop:20,marginBottom:20}}>工作内容:</View>
          <View>
          <Textarea className='myIntro' name='detail' value={Info.detail} onBlur={(e)=>{console.log(1);handleChange('detail',e.detail.value)}}>
      </Textarea>
          </View>
        </View>
    </View>
  )
}